<?php
/**
 * Created by IntelliJ IDEA.
 * User: william
 * Date: 7/10/12
 * Time: 10:02 PM
 * To change this template use File | Settings | File Templates.
 */

include("dbcon.php");


if ($teams = $mysqli->query('select t.Name, t.Code from history h, lut_teams t where h.Home = t.Code group by t.Name')) {

    while($teamrow = $teams->fetch_array())
    {
        $teamrows[] = $teamrow;
    }

    foreach($teamrows as $row)
    {
    ?>
    <option value="<?php echo $row['Code']; ?>"><?php echo $row['Name']; ?></option>
    <?php
    }

    /* free result set */
    $teams->close();
}

?>